package com.liusu.spider.test;

import com.liusu.spider.request.Request;
import org.junit.jupiter.api.Test;

import java.util.HashMap;
import java.util.Map;

public class PassPirate {


    public String cookie = "pgv_pvid=8061423836; PHPSESSID=kqufq4rfffk6mtluma4m9670l4";
    /**
     * action: refuseRush
     * params: [1627366454]
     * service: PirateTeamService
     * _02B4Z6wo00f01YflnggAAIDCT1lXFLC9dVGH5ZqAAAD.50
     * _02B4Z6wo00f013aBRKAAAIDAvj2NvlOyJjt2gUAAALyzda
     * 跳过海盗
     */
    @Test
    public void context(){
        Request request = new Request();
        String url = "http://qzone.gz.1251013877.clb.myqcloud.com/gateway.php";
        Map<String,Object> data = new HashMap<>();
        data.put("action","refuseRush");
        data.put("params","[1628561472]");
        data.put("service","PirateTeamService");

        HashMap<String,String> headers = new HashMap<>();
        headers.put("Cookie",cookie);

        for (int i = 0; i < 15; i++) {
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            String html = request.post(url,data,headers);
            System.out.println(html);
        }
    }

    /**
     * 2000 4000 6000 9000 10000 12000 16000 24000 33000 41500
     * 0    5    125  155  185   215   245   275   305   335
     * a11a849ab99faeb8
     * 自动领取奖励
     * 130+155+185
     * 130+340+215+215
     *
     */
    @Test
    public void reward(){
        Request request = new Request();
        int[] ints = {5, 125, 155, 185, 215, 245, 275, 305, 335};

        String url = "http://qzone.gz.1251013877.clb.myqcloud.com/gateway.php";
        Map<String,Object> data = new HashMap<>();
        data.put("action","onlineRewards");
        data.put("params","[1627872386]");
        data.put("service","UserService");

        HashMap<String,String> headers = new HashMap<>();
        headers.put("Cookie",cookie);
        for (int t : ints) {
            try {
                Thread.sleep((t+5)*1000);
                String html = request.post(url,data,headers);
                System.out.println(html);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }




        /*
        *
        *
        * 256 *256*256*256
        * 2^32
        *
        *
        * */


    }
    /**
     * 测试一下删掉日志的配置文件 还有没有日志输出
     *
     */
    @Test
    public void test_log_print(){

        Request request = new Request();

        String url = "https://www.sogou.com/";

        String html = request.get(url);

        System.out.println(html);

    }

}
